package org.pearl.mp.danamic.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.pearl.mp.danamic.dao.AccountTblMapper;
import org.pearl.mp.danamic.entity.AccountTbl;
import org.pearl.mp.danamic.service.AccountTblService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author td
 * @since 2020-01-02
 */
@Service
@Slf4j
public class AccountTblServiceImpl extends ServiceImpl<AccountTblMapper, AccountTbl> implements AccountTblService {

    @Autowired
    AccountTblMapper accountTblMapper;

    @Override
    public void reduceMoney() {
        // 扣除账户余额
        AccountTbl accountTbl = accountTblMapper.selectById(12);
        AccountTbl accountTbl1 = accountTbl.setMoney(accountTbl.getMoney() - 1);
        accountTblMapper.updateById(accountTbl1);
    }
}
